package cn.lsc.web.controller;

import cn.lsc.result.JSONResult;
import cn.lsc.service.ITokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TokenController {

    @Autowired
    private ITokenService iTokenService;
    //生成防重复token使用场景是用户点击购买得时候获取到token跳转到下单页面
    @GetMapping("/createToken/{courseId}")
    public JSONResult createToken(@PathVariable("courseId")Long courseId){
       String token= iTokenService.createToken(courseId);
        return JSONResult.success(token);
    }
}
